<template>
	<view class="wos">
		<view class="message_top">
			<view class="message_top_title" :style="{top:computedTop}"></view>
			<view class="message_top_back" :style="{top:computedTop}" @click="Back">
				<image src="../../static/search/back.png" class="bfbimages"></image>
			</view>
		</view>
		
		<view class="wos_images flex">
			<image src="../../static/or_success.png" class="bfbimages"></image>
		</view>
		<view v-if="type == 1" class="wos_text">签到成功</view>
		<view v-else class="wos_text">核销成功</view>
		
		
		<view class="wos_btn" @click="Back2" style="background: linear-gradient( 270deg, #FE4624 0%, #FF8143 100%);">继续扫码</view>
		<view class="wos_btn" style="background-color: #FFFFFF;color: #333333;border: 2rpx solid #999999;margin: 50rpx auto 0;" @click="CkanJL">查看核销记录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuButtonInfo: null,
				type:1,
			}
		},
		computed: {
			computedTop() {
				if (this.menuButtonInfo) {
					return `${this.menuButtonInfo.height * 2 - 6}px`;
				}
				return '0px';
			},
		},
		onLoad(option) {
			this.type = option.type
			const info = uni.getMenuButtonBoundingClientRect();
			this.menuButtonInfo = info;
		},
		methods: {
			CkanJL(){
				uni.navigateTo({
					url:'/pages/WriteOff/WriteOff_list'
				})
			},
			Back(){
				uni.navigateBack()
			},
			Back2(){
				let _this=this
				uni.scanCode({
					success: function (res) {
						let data = {
							user_activity_id: res.result,
						}
						_this.$request('/api/receive/writeOoff',data).then((res) => {
							  uni.navigateTo({
							  	url:'/pages/WriteOff/WriteOff_list'
							  })
						})
						console.log(res.result);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.wos{
		width: 100vw;
		height: 100vh;
		float: left;
		background-color: #FFFFFF;
	}
	.message_top {
		width: 100%;
		height: 200rpx;
		position: relative;

		.message_top_title {
			width: 100%;
			text-align: center;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #333333;
			position: absolute;
			left: 0;
			z-index: 2;
		}

		.message_top_back {
			width: 44rpx;
			height: 44rpx;
			position: absolute;
			left: 30rpx;
			z-index: 9;
		}
	}
	
	.wos_images{
		width: 141rpx;
		height:141rpx;
		border-radius: 50%;
		margin: 130rpx auto 0;
	}
	.wos_text{
		width: 100%;
		text-align: center;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
		margin-top: 30rpx;
	}
	.wos_btn{
		width: 431rpx;
		height: 79rpx;
		border-radius: 50rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		font-size: 30rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 79rpx;
		margin: 100rpx auto 0;
	}
</style>
